home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 187_01 / getint.c < prev    next >
C/C++ Source or Header  |  1985-12-28  |  884b  |  29 lines

  1. /*@*****************************************************/
  2. /*@                                                    */
  3. /*@ getint - read in two binary bytes and treat them   */
  4. /*@        as a reverse 2-byte number.                 */
  5. /*@                                                    */
  6. /*@   Usage:     getint(fp);                           */
  7. /*@       where fp is a file handle.                   */
  8. /*@     Returns an int which is the binary value.      */
  9. /*@                                                    */
  10. /*@*****************************************************/
  11.  
  12. #include "stdio.h"
  13.  
  14. /*******************************************************/
  15.  
  16. int getint(fp)
  17. FILE       *fp;       /* File to process        */
  18. /*
  19.  * Read two binary bytes and treat them as reverse 2-byte number.
  20.  */
  21. {
  22.     char c;
  23.  
  24.     c = fgetc(fp);   
  25.     return(c+(256*fgetc(fp)));
  26. }
  27.  
  28.  
  29.